<?php if (count($languages) > 1) { ?>
    <?php
    $lang_html = '';
    foreach ($languages as $language) {
        $lang_html .= '<form action=\'' . $action . '\' method=\'post\' enctype=\'multipart/form-data\'>';
        $lang_html .= '<input type=\'image\' src=\'image/flags/' . $language['image'] . '\' alt=\'' . $language['name'] . '\' value=\'' . $language['name'] . '\' />';
        $lang_html .= '<input type=\'hidden\' name=\'language_code\' value=\'' . $language['code'] . '\' /><input type=\'hidden\' name=\'redirect\' value=\'' . $redirect . '\' />';
        $lang_html .= '</form>';
    }
    ?>
    <a id="open_languages"><img src="catalog/view/theme/mobile/image/globe.png" alt="<?php echo $text_language; ?>" /></a> 
    <script type="text/javascript">
        $(document).delegate('#open_languages', 'click', function() {
            $(this).simpledialog({
                'mode': 'blank',
                'prompt': false,
                'forceInput': false,
                'useModal':true,
                'fullHTML':
                    "<?php echo $lang_html ?><a rel='close' data-role='button' href='#' id='simpleclose'>Close</a>"
            })
        });
    </script>
<?php } ?>
